package serveur.controller;

import java.io.BufferedWriter;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
/**
 * 
 * @author michael
 *
 */
public class Serveur {
	static List<BufferedWriter> bwListe = new ArrayList<BufferedWriter>();
	public static final String cheminDossier = "src/serveur/image/";
    ServerSocket s;
 	Socket c;

 	//creation d'un thread par joueur
	Thread threadConnect = new Thread(){
		public void run(){
			 try {
				while(true){
					c=s.accept();
					ThreadJoueur t = new ThreadJoueur(c);
					Thread broadcast = new Thread(t);
					t.start();
					broadcast.start();
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} 
	};
	
	public Serveur(){
		try {
			s = new ServerSocket(1032);
			threadConnect.start();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
	}
}
